<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="Jsp.User" %>
<%@ page import="java.util.*" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/11
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%
    User u1=new User("张三",18,new Date());
    User u2=new User("lili",17,new Date());
    User u3=new User("tom",19,new Date());
    List<User> userList=new ArrayList<User>();

    userList.add(u1);
    userList.add(u2);
    userList.add(u3);
    request.setAttribute("userList",userList);

    Map<Integer,User>userMap=new HashMap<Integer, User>();
    userMap.put(1,u1);
    userMap.put(2,u2);
    userMap.put(3,u3);
    request.setAttribute("userMap",userMap);





%>
<table border="1" align="center">
    <tr>
    <td>编号</td><td>姓名</td><td>年龄</td><td>生日</td>
    </tr>
        <c:forEach items="${userList}" var="u" varStatus="s">
            <c:if test="${s.index%2==0}">
                <tr bgcolor="aqua">
            </c:if>
            <c:if test="${s.index%2!=0}">
                <tr bgcolor=#ffc0cb>
            </c:if>
            <td>${s.index+1}</td>
            <td>${u.name}</td>
            <td>${u.age}</td>
            <td>${u.birthday}</td>
            </tr>
        </c:forEach>
</table>




</body>
</html>
